import { SpriteFrame, resources } from "cc";
import {Single} from "db://assets/Base/Single";

export default class ResLoad extends Single {
    static get Instance() {
        return super.getInstance<ResLoad>();
    }
    load(path: string, type: typeof SpriteFrame = SpriteFrame) {
        return new Promise<SpriteFrame>((resolve, reject) => {
            resources.load(path, type, (err, assets) => {
                if (err) {
                    reject(err);
                    return;
                }
                resolve(assets);
            });
        });
    }

}


